using SqlSugar;
using Timo.Common.Extension;

namespace Timo.Model.Timo.dbo.Base;

/// <summary>
/// 框架实体基类Id
/// </summary>
public abstract class EntityBaseId
{
    /// <summary>
    /// Id
    /// </summary>
    [SugarColumn(ColumnDescription = "Id", IsPrimaryKey = true, IsIdentity = true)]
    public virtual long Id { get; set; }
}

/// <summary>
/// 框架实体基类
/// </summary>
public abstract class EntityBase : EntityBaseId, IDeletedFilter
{
    /// <summary>
    /// 创建时间
    /// </summary>
    [SugarColumn(ColumnDescription = "创建时间", IsOnlyIgnoreUpdate = true)]
    public virtual long? CreateAt { get; set; } = TimeHelper.GetTimeStamp();

    /// <summary>
    /// 更新时间
    /// </summary>
    [SugarColumn(ColumnDescription = "更新时间", IsOnlyIgnoreInsert = true)]
    public virtual long? ModifiedAt { get; set; } = default(long?);

    /// <summary>
    /// 创建者Id
    /// </summary>
    [SugarColumn(ColumnDescription = "创建者Id", IsOnlyIgnoreUpdate = true)]
    public virtual long? CreateBy { get; set; } = default(long?);

    /// <summary>
    /// 修改者Id
    /// </summary>
    [SugarColumn(ColumnDescription = "修改者Id", IsOnlyIgnoreInsert = true)]
    public virtual long? ModifiedBy { get; set; } = default(long?);

    /// <summary>
    /// 删除时间
    /// </summary>
    [SugarColumn(ColumnDescription = "删除时间", IsOnlyIgnoreUpdate = true)]
    public virtual long? DeleteAt { get; set; } = default(long?);

    /// <summary>
    /// 删除者Id
    /// </summary>
    [SugarColumn(ColumnDescription = "删除者Id", IsOnlyIgnoreInsert = true)]
    public virtual long? DeleteBy { get; set; } = default(long?);

    /// <summary>
    /// 软删除
    /// </summary>
    [SugarColumn(ColumnDescription = "软删除")]
    public virtual bool IsDelete { get; set; } = false;

    /// <summary>
    /// 备注
    /// </summary>
    [SugarColumn(ColumnDescription = "备注")]
    public virtual string? Remarks { get; set; } = string.Empty;
}